{% comment %} https://validator.schema.org/ {% endcomment %}
<!-- Oemsaas LD+JSON Start -->
<script type="application/ld+json">
{
	"@context": "https://schema.org",
	"@type": "WebSite",
	"url": "https://{{ current_domain }}",
	"name": "{{ storeInfo.shop_name }}",
	"potentialAction": [{
			"@type": "SearchAction",
			"target": "https://{{ current_domain }}/search?q={search_term_string}",
			"query-input": "required name=search_term_string"
		}]
}
</script>
<script type="application/ld+json">
{%- capture link -%}
  {%- if theme_config.global.sns_link_facebook -%}
    ,{{ theme_config.global.sns_link_facebook}}
  {%- endif -%}
  
  {%- if theme_config.global.sns_link_twitter -%}
    ,{{ theme_config.global.sns_link_twitter}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_pinterest -%}
    ,{{ theme_config.global.sns_link_pinterest}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_instagram -%}
    ,{{ theme_config.global.sns_link_instagram}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_snapchat -%}
    ,{{ theme_config.global.sns_link_snapchat}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_tiktok -%}
    ,{{ theme_config.global.sns_link_tiktok}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_tumblr -%}
    ,{{ theme_config.global.sns_link_tumblr}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_linkedin -%}
    ,{{ theme_config.global.sns_link_linkedin}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_youtube -%}
    ,{{ theme_config.global.sns_link_youtube}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_vimeo -%}
    ,{{ theme_config.global.sns_link_vimeo}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_vk -%}
    ,{{ theme_config.global.sns_link_vk}}
  {%- endif -%}

  {%- if theme_config.global.sns_link_whatsapp -%}
    ,{{ theme_config.global.sns_link_whatsapp}}
  {%- endif -%}

{%- endcapture -%}
{% assign links = link | split :","  %}
{
	"@context": "http://schema.org",
    "@type": "Organization",
   	"name" : "{{ storeInfo.shop_name }}",
    "url": "https://{{ current_domain }}",
	"logo": "{{ storeConfig.logo }}",
	"legalName" : "{{ storeConfig.shop_address_company | escape }}",
	"telephone": "{{ storeConfig.shop_address_phone | escape }}",
	"email": "{{ storeConfig.service_email }}",
	"address": {
	 "@type": "PostalAddress",
	 "streetAddress": "{{ storeConfig.shop_address_line1 | escape }} {{ storeConfig.shop_address_line2 | escape }}",
	 "addressLocality": "{{ storeConfig.shop_address_city | escape }}",
	 "addressRegion": "{{ storeConfig.shop_address_province_name | escape }}",
	 "postalCode": "{{ storeConfig.shop_address_zip | escape }}",
	 "addressCountry": "{{ storeConfig.shop_address_country }}"
 	},
	"contactPoint": {
	 "@type": "ContactPoint",
	 "contactType": "Service",
	 "telephone": "{{ storeConfig.shop_address_phone | escape }}",
	 "email": "{{ storeConfig.service_email }}"
 	},
	 "sameAs": [
	  {%- for item in links -%}
      {%- if item -%}
        "{{- item -}}"{% unless forloop.last %},{% endunless %}
      {%- endif -%}
    {%- endfor -%}
	 ]
}
</script>
{% if template == 'index' %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    }]
	}
</script>
    {% comment %}3 搜索页{% endcomment %}
{% elsif template == 'search_detail' and search.keywords == false %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    },{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ lang.search.search }}",
      "item": "https://{{ current_domain }}/search"
    }]
	}
</script>
{% elsif template == 'search_detail' and search.keywords %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    },{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ lang.search.search }}",
      "item": "https://{{ current_domain }}/search"
    },{
      "@type": "ListItem",
      "position": 3,
      "name": "{{ search.keywords | escape }}",
      "item": "https://{{ current_domain }}/search?q={{ search.keywords }}&page=1"
    }]
	}
</script>
{% comment %}4 集合列表 {% endcomment %}
{% elsif template == 'collection_list' %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    },{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ lang.general.collections }}",
      "item": "https://{{ current_domain }}/collections"
    }]
	}
</script>
{% elsif template == 'collection_detail' %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    },{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ lang.general.collections }}",
      "item": "https://{{ current_domain }}/collections"
    },{
      "@type": "ListItem",
      "position": 3,
      "name": "{{ collection.title | escape }}",
      "item": "https://{{ current_domain }}/collections/{{ collection.handle }}"
    }]
	}
</script>
{% elsif template == 'blog_list' %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    },{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ lang.blogs.list.news }}",
      "item": "https://{{ current_domain }}/blogs"
    }]
	}
</script>
{% elsif template == 'blog_detail' %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    },{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ lang.blogs.list.news }}",
      "item": "https://{{ current_domain }}/blogs"
    },{
      "@type": "ListItem",
      "position": 3,
      "name": "{{ blog.title | escape }}",
      "item": "https://{{ current_domain }}/blogs/{{ blog.handle }}"
    }]
	}
</script>
<script type="application/ld+json">
    {
	"@context": "https://schema.org",
	"@type": "Article",
	"url": "https://{{ current_domain }}/blogs/{{ blog.handle }}",
	"mainEntityOfPage": "https://{{ current_domain }}/blogs/{{ blog.handle }}",
	"name": "{{ blog.title | escape }}",
	"author": "{{ blog.author_name }}",
	"publisher": {
		"@type": "Organization",
		"name": "{{ storeInfo.shop_name }}"
		},
	"headline": "{{ blog.title | escape }}",
	"image": {
		"@type": "ImageObject",
		"width": 1024,
		"height": 1024,
		"url": "{{ blog.src }}"
		},
	"datePublished": "{{ blog.published_at | date: "%Y-%m-%d %H:%M:%S" }}",
	"dateCreated": "{{ blog.created_at | date: "%Y-%m-%d %H:%M:%S"}}",
	"dateModified": "{{ blog.updated_at | date: "%Y-%m-%d %H:%M:%S"}}",
	"description": "{{ blog.descript }}" ,
	"articleBody":"{{ blog.content | strip_html | replace:"&nbsp;" , "/r/n" | strip_newlines }}"
	}
</script>
{% elsif template == 'page_detail' %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    },{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ page.title | escape }}",
      "item": "https://{{ current_domain }}/pages/{{ page.handle }}"
    }]
	}
</script>
{% elsif template == 'product_detail' %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    }{%- if product.current_collection -%}
     ,{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ product.current_collection.title | escape }}",
      "item": "https://{{ current_domain }}/collections/{{product.current_collection.handle}}"
    },{
      "@type": "ListItem",
      "position": 3,
      "name": "{{ product.title | escape }}",
      "item": "https://{{ current_domain }}/products/{{ product.handle }}"
    }
	{%- else -%}
	,{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ product.title | escape }}",
      "item": "https://{{ current_domain }}/products/{{ product.handle }}"
    }
    {%- endif -%}]
	}
</script>
<script type="application/ld+json">
   
    {
        "@context": "http://schema.org/",
        "@type": "Product",
        "name": "{{ product.title | escape }}",
        "image": [{%- for image_item in product.images -%}"{{ image_item.src }}"{% unless forloop.last %},{% endunless %}{%- endfor -%}],
        "description": "{{ product.mini_detail | escape }}",
        "mpn": "{{ product.spu }}",
		"itemCondition": "http://schema.org/NewCondition",
		"category":"{{ product.product_type }}",
        "offers":[{%- for variant_item in product.variants -%}
        {
            "@type":"Offer",
            "priceCurrency": "{{ storeConfig.currency_default }}",
            "price" : "{{ variant_item.price }}",
            "itemCondition": "http://schema.org/NewCondition",
            "mpn": "{{ variant_item.sku }}",
            "sku": "{{ variant_item.sku }}",
            "gtin": "{{ variant_item.barcode }}",
            "url" : "https://{{ current_domain }}/products/{{ product.handle }}?sku_code={{ variant_item.sku_code }}&sku={{ variant_item.sku }}",
            {% if product.status == 1 %}
                 {%- if variant_item.inventory_quantity > 0 -%}
                 "availability" : "http://schema.org/InStock"
                 {%- elsif product.inventory_tracking == 0 -%}
                 "availability" : "http://schema.org/InStock"
                 {%- else -%}
                 "availability" : "http://schema.org/OutOfStock"
                 {%- endif -%}
            {%- else -%}
                 "availability" : "http://schema.org/SoldOut"
            {%- endif -%}
		}
		{% unless forloop.last %},{% endunless %}
        {%- endfor -%}],
        "url" : "https://{{ current_domain }}/products/{{ product.handle }}"
        {%- if product.comment_total_count > 0 -%}
            ,
            "aggregateRating":{
            "@type":"AggregateRating",
            {% if product.comment_count > 0 %}
            "ratingValue":"{{ product.comment_value | divided_by: product.comment_count | round:1}}",
            {% else %}
            "ratingValue":"0",
            {% endif %}
            "reviewCount":"{{ product.comment_count }}"
            },
            "review":[
               {%- for comment_item in comments -%}
                    {
                        "@type":"Review",
                        "author":"{{ comment_item.customer_name | escape }}",
                        "datePublished":"{{ comment_item.created_at | date: "%Y-%m-%d" }}",
                        "reviewBody":"{{ comment_item.content | escape }}",
                        "name":"Review-{{ comment_item.id }}",
                        "reviewRating":{
                            "@type" : "Rating",
                            "bestRating": "5",
                            "ratingValue" : "{{ comment_item.star }}",
                            "worstRating" : "1"
                        }
                    }
                    {% unless forloop.last %},{% endunless %}
                    {%- endfor -%}
               ]
		{% endif %}
       
    }

    </script>
{% endif %}
{% comment %}5 评论列表{% endcomment %}
{% if template == 'comments_list' %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    },{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ lang.comments.title }}",
      "item": "https://{{ current_domain }}/comments"
    }]
	}
</script>
<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "Organization",
   "name" : "{{ storeInfo.shop_name }}",
   "url": "https://{{ current_domain }}",
    "aggregateRating": {
    "@type": "AggregateRating",
		"ratingValue": "{{ all_comment.statistics.star }}",
		"reviewCount": "{{ all_comment.statistics.count }}"
  	},
    "review":[
     {%- for comment in all_comment.comments -%}
      {
		  "@type":"Review",
		  "author":"{{ comment.customer_name | escape  }}",
		  "datePublished":"{{ comment.created_at | date: "%Y-%m-%d" }}",
		  "reviewBody":"{{ comment.content | escape }}",
		  "name":"Review-{{ comment.id }}",
		  "reviewRating":{
			  "@type" : "Rating",
			  "bestRating": "5",
			  "ratingValue" : "{{ comment.star }}",
			  "worstRating" : "1"
		  }
      }{% unless forloop.last %},{% endunless %}
    {%- endfor -%}
      ]
}

    </script>
    {% comment %}6 商品评论页{% endcomment %}
{% elsif template == 'comments_detail' %}
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BreadcrumbList",
  	"itemListElement": [{
      "@type": "ListItem",
      "position": 1,
      "name": "{{ lang.layout.navigation.home }}",
      "item": "https://{{ current_domain }}"
    },{
      "@type": "ListItem",
      "position": 2,
      "name": "{{ lang.comments.title }}",
      "item": "https://{{ current_domain }}/comments"
    },{
      "@type": "ListItem",
      "position": 3,
      "name": "{{ product_comment.product.title | escape }}",
      "item": "https://{{ current_domain }}/comments/{{ product_comment.product.handle }}"
    }]
	}
</script>
    <script type="application/ld+json">
    {
        "@context": "http://schema.org/",
        "@type": "Product",
        "name": "{{ product_comment.product.title | escape }}",
        "image": [{%- for image_item in product_comment.product.images -%}"{{ image_item.src }}"{% unless forloop.last %},{% endunless %}{%- endfor -%}],
        "description": "{{ product_comment.product.mini_detail | escape }}",
        "mpn": "{{ product_comment.product.spu }}",
		"itemCondition": "http://schema.org/NewCondition",
		"category":"{{ product_comment.product.product_type }}",
        "offers":[{%- for variant_item in variant -%}
        {
            "@type":"Offer",
            "priceCurrency": "{{ storeConfig.currency_default }}",
            "price" : "{{ variant_item.price }}",
            "itemCondition": "http://schema.org/NewCondition",
            "mpn": "{{ variant_item.sku }}",
            "sku": "{{ variant_item.sku }}",
            "gtin": "{{ variant_item.barcode }}",
            "url" : "https://{{ current_domain }}/products/{{ product.handle }}?sku_code={{ variant_item.sku_code }}&sku={{ variant_item.sku }}",
            {% if product.status == 1 %}
    {%- if variant_item.inventory_quantity > 0 -%}
                 "availability" : "http://schema.org/InStock"
                 {%- elsif product.inventory_tracking == 0 -%}
                 "availability" : "http://schema.org/InStock"
                 {%- else -%}
                 "availability" : "http://schema.org/OutOfStock"
                 {%- endif -%}
    {%- else -%}
                 "availability" : "http://schema.org/SoldOut"
            {%- endif -%}
		}
		{% unless forloop.last %},{% endunless %}
        {%- endfor -%}],
        "url" : "https://{{ current_domain }}/products/{{ product_comment.product.handle }}"
        {%- if product_comment.product.comment_total_count > 0 -%}
            ,
            "aggregateRating":{
            "@type":"AggregateRating",
            "ratingValue":"{{ product_comment.product.comment_value | divided_by: product_comment.product.comment_count | round:1}}",
            "reviewCount":"{{ product_comment.product.comment_count }}"
            },
            "review":[
               {%- for comment_item in product_comment.comments -%}
                    {
                        "@type":"Review",
                        "author":"{{ comment_item.customer_name | escape }}",
                        "datePublished":"{{ comment_item.created_at | date: "%Y-%m-%d" }}",
                        "reviewBody":"{{ comment_item.content | escape }}",
                        "name":"Review-{{ comment_item.id }}",
                        "reviewRating":{
                            "@type" : "Rating",
                            "bestRating": "5",
                            "ratingValue" : "{{ comment_item.star }}",
                            "worstRating" : "1"
                        }
                    }
                    {% unless forloop.last %},{% endunless %}
        {%- endfor -%}
               ]
		{% endif %}

    }

    </script>
{% endif %}
<!-- Oemsaas LD+JSON End -->